home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Controls / Visual Basic Controls.iso / vbcontrol / vidhandl / ascii.cpp next >
Encoding:
C/C++ Source or Header  |  1999-02-03  |  1.6 KB  |  61 lines

  1. /* ASCII - DISPLAYS CURRENT DOS CHARACTER FONT SELECTED           */
  2. /*   ALSO AN EXAMPLE OF VIDEO HANDLING FUNCTIONS                  */
  3.  
  4. #include <crt.h>
  5.  
  6. #define CGA  1
  7. #define MCGA 2
  8. #define EGA  3
  9. #define VGA  9
  10.  
  11. #define VIDEO_ADAPTER VGA
  12.   //if your video adapter isn't VGA, redefine VIDEO_ADAPTER with one of
  13.   //above adapter types.
  14.  
  15. void main ()
  16.  {
  17.     int c0,c1;
  18.  
  19.     crt_detect(VIDEO_ADAPTER);//gets current video status (it is, number of rows, columns, etc)
  20.  
  21.     fillscr (' ',7); //clears the screen
  22.  
  23.   //Writes all 256 ascii characters
  24.     for (c0=0;c0<8;c0++)
  25.         for (c1=0;c1<16;c1++)
  26.          {
  27.             printc (c0*16+c1,c1+17,c0+6,0x0b);
  28.             printc (c0*16+c1+128,c1+42,c0+6,0x0b);
  29.          }
  30.  
  31.   //displays title
  32.     printsj ("Extended ASCII table (or current DOS character font):",1,0x0e);
  33.  
  34.   //writes the text beside and the line between the 256 characters
  35.     for (c0=0;c0<8;c0++)
  36.      {
  37.         prints ("(00)h ",10,6+c0,0x0f);
  38.         prints ("(80)h ",60,6+c0,0x0f);
  39.         printc (c0+0x30,11,6+c0,0x0f);
  40.         printc (c0+0x3f,61,6+c0,0x0f);
  41.         printc ('║',37,6+c0,0x0f);
  42.      }
  43.     printc ('8',61,6,0x0f);
  44.     printc ('9',61,7,0x0f);
  45.  
  46.   //Displays the numbers in white over the 256 characters
  47.     for (c1=17;c1<60;c1+=25)
  48.      {
  49.         for (c0=c1;c0<(c1+16);c0++)
  50.             printc('0',c0,3,0x0f);
  51.         prints ("0123456789ABCDEF",c1,4,0x0f);
  52.      }
  53.  
  54.   //repositions the cursor at the begin of the immediate line that follows the
  55.   //lowermost written line.
  56.     crt_gotoxy(0,14);
  57.  }
  58.  
  59. // By Marcio Afonso Arimura Fialho
  60. // http://pessoal.iconet.com.br/jlfialho
  61. // e-mail: jlfialho@iconet.com.br or (alternate) jlfialho@yahoo.com